Detecting Windows Version

Colin Fahey

(Submitted by: Bam/evolve)

   Date sent:              Thu, 05 Aug 1999 18:21:56 -0800
   To:                     OPENGL-GAMEDEV-L@fatcity.com
   Send reply to:          OPENGL-GAMEDEV-L@fatcity.com
   From:                   Colin Fahey <cfahey@adrenalin.com>
   Subject:                Re: OT - Windows Version...
   Organization:           Fat City Network Services, San Diego, California

   > Todd Poynter wrote:
   > >
   > > Hi, does anyone know if there is a Win32 call to get the Windows
   > > version a machine is running, such as WinNT 4, WinNT5, Win98, Win95
   > > and so on? This is at it's heart OpenGL related. :)

   Here is some pseudocode that should work:

   // =================================

           Load Windows Startup Screen;
           Do Optical Character Recognition on Image;
           if (Text Found Contains "95")
               You Have Window95;
           else if (Text Found Contains "98")
               You Have Windows98;
           else if (Text Contains "NT")
               You Have WindowsNT;
           else
               Attend Microsoft Product ID Days;

   // =================================

   An alternative method is:

   // =================================

           Run Netscape;
           if (Blue Screen Of Death contains register dump)
               You Were Running Windows NT;
           else if (Fatal Exception occurred in VxD)
               You Were Running Windows95;
           else if ("The System Has Become Unstable...
               It may be possible for you to return to
               Windows..." gives you false hope before
               hitting CTRL-ALT-DEL again)
               You Were Running Windows98;
           else if (Everything is Fine)
               Attend Microsoft Product ID Days!;
   // =================================

   But the most practical WinXX detection code is:

   // =================================

           try { outp(...); }
           catch() {  You've Got WinNT;  };

           Write to your own network port 139;
           if (Blue Screen Of Death)
               You've Got Win98;

           Create four "device contexts";
           if (You can't create one more)
               You've Got Win95;
   // =================================

   Other methods include:
   (1) Measuring the size of the End User License Agreement (EULA);
   (2) Checking the version of Solitaire;
   (3) Timing the Reboot process;
   (4) Checking if the path "C:\WINDOWS\PROFILES\ALL USERS\
       ADMINISTRATOR\DESKTOP\MY USELESS BRIEFCASE\
       1000-POUND USELESS MSCE BOOK" exists.


   -----
   FAQ and OpenGL Resources at:
     http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

   --
   Author: Colin Fahey
     INET: cfahey@adrenalin.com

   Fat City Network Services    -- (619) 538-5051  FAX: (619) 538-5051
   San Diego, California        -- Public Internet access / Mailing Lists